home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -in_the_mag- / basics / amos / hrainbows.lha / havoc_rainbows / Displayer.AMOS / Displayer.amosSourceCode < prev   
AMOS Source Code  |  1980-02-21  |  4KB  |  119 lines

  1. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. 'Procedure to display rainbows made with Rainbow designer  
  3. 'By John Hawkins 
  4. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  5.  
  6.  
  7. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  8. 'Loading the rainbow in: 
  9. '----------------------- 
  10. '
  11. '      Once you have created your rainbow in the editor and
  12. '      saved it to disc, loading it becomes very simple. Whilst
  13. '      editing the program in which the rainbow is to be 
  14. '      included, skip to direct mode (Hit ESC), and type this: 
  15. '
  16. '      load "filename.rain"
  17. '
  18. '      This will load the file named "filename.rain" straight
  19. '      into bank 10. Alternatively, you may want to load your
  20. '      rainbow into a different bank. This can be done thusly: 
  21. '
  22. '      load "filename.rain",bank number
  23. '
  24. '      Where bank number is the bank to be occupied. Remember
  25. '      as part of the filename to include the path if necessary. 
  26. '
  27. 'E.g:
  28. '
  29. 'load "df0:myrainbow.rain" 
  30. '
  31. '      loads myrainbow.rain straight into bank 10 from the   
  32. '      internal drive. 
  33. '
  34. 'load "df1:data/big.rain",7  
  35. '
  36. '      loads big.rain into bank 7 from the a directory named 
  37. '      data on the second drive. 
  38. '
  39. '
  40. 'Displaying the rainbow: 
  41. '----------------------- 
  42. '
  43. 'To call the procedure the syntax is as follows: 
  44. '
  45. '
  46. '_SUPER_RAINBOW[_BANK,_INDEX,_POSITION,_RAIN_NUMBER] 
  47. '
  48. 'Where:
  49. '
  50. '_BANK        is the number of the bank that contains your   
  51. '             rainbow. This obviously depends upon which bank  
  52. '             you loaded it into. The standard is 10.  
  53. '
  54. '_INDEX       is the palette colour that you wish the rainbow
  55. '             to replace, as used in the Set Rainbow command.
  56. '
  57. '_POSITION    is the vertical position on screen that you wish 
  58. '             the rainbow to be displayed from, in HARDWARE
  59. '             co-ordinates. The lowest possible is about 40. 
  60. '  
  61. '_RAIN_NUMBER is the identification number of the rainbow to 
  62. '             set up, from 0 to 3, just like the standard AMOS 
  63. '             system.  
  64. '
  65. 'E.g:
  66. '
  67. '_SUPER_RAINBOW[10,0,60,1] 
  68. '
  69. '      Display the rainbow in bank 10, replacing colour 0, at a
  70. '      vertical hardware co-ordinate of 60 (near the top), 
  71. '      using rainbow 'channel' 1.
  72. '
  73. '_SUPER_RAINBOW[8,6,200,0] 
  74. '
  75. '      Display the rainbow from bank 8, replacing colour 6, at 
  76. '      the vertical hardware co-ordinate of 200 (nearer the
  77. '      bottom), and using 'channel' 0
  78. '
  79. '
  80. 'Some more examples are entered below, and these can also be 
  81. 'run to see the effects. 
  82. '
  83. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  84.  
  85.  
  86. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  87. 'The actual procedure: 
  88. '
  89. 'You should use the copy and paste functions from the AMOS 
  90. 'editor to get this into your own program before using.
  91. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  92. Procedure _SUPER_RAINBOW[_BANK,_INDEX,_POSITION,_RAIN_NUMBER]
  93. If Prg State=-1 : FIDDLE=-1 : Else FIDDLE=0 : End If 
  94.    ID$=""
  95.    For IDCHAR=0 To 7
  96.       ID$=ID$+Chr$(Peek(Start(_BANK)-8+IDCHAR))
  97.    Next IDCHAR
  98.    If ID$="Rainbow "
  99.       Set Rainbow _RAIN_NUMBER,_INDEX,(Length(_BANK)/2)+FIDDLE,"","",""
  100.       Rainbow _RAIN_NUMBER,0,_POSITION,(Length(_BANK)/2)+FIDDLE
  101.       For _LINE_NUMBER=0 To(Length(_BANK)/2)-2+FIDDLE
  102.          Rain(_RAIN_NUMBER,_LINE_NUMBER)=Deek(Start(_BANK)+_LINE_NUMBER*2)
  103.       Next _LINE_NUMBER
  104.    End If 
  105. End Proc
  106. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  107.  
  108.  
  109. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  110. 'Below are some examples:
  111. 'First a screen is set up. 
  112. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  113. Screen Open 0,320,256,2,Lowres : Curs Off : Flash Off : Cls 0 : Hide On 
  114. Auto View Off 
  115.  
  116. _SUPER_RAINBOW[6,0,60,0] : View 
  117. Wait Key : Rainbow Del 0
  118. _SUPER_RAINBOW[10,0,40,0] : View 
  119. Wait Key : Rainbow Del 0